<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>从零到白嫖之博客搭建 | mozihao</title><meta name="keywords" content="博客搭建"><meta name="author" content="mozihao"><meta name="copyright" content="mozihao"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="11.本地环境需求 Git  node.js   上面这两个百度自行安装一下 2.开始部署 在本地创建Blog文件夹并进入，用来存放项目  安装淘宝镜像cnpm  快捷键：win + r 然后输入cmd，然后确认  然后输入下面命令，按回车键，等待安装完毕 1npm install -g cnpm --registry&#x3D;https:&#x2F;&#x2F;registry.npm.tao">
<meta property="og:type" content="article">
<meta property="og:title" content="从零到白嫖之博客搭建">
<meta property="og:url" content="https://mo_zi_hao.gitee.io/blog/posts/40469/index.html">
<meta property="og:site_name" content="mozihao">
<meta property="og:description" content="11.本地环境需求 Git  node.js   上面这两个百度自行安装一下 2.开始部署 在本地创建Blog文件夹并进入，用来存放项目  安装淘宝镜像cnpm  快捷键：win + r 然后输入cmd，然后确认  然后输入下面命令，按回车键，等待安装完毕 1npm install -g cnpm --registry&#x3D;https:&#x2F;&#x2F;registry.npm.tao">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/%E6%B5%B7%E8%B4%BCwang5.jpg">
<meta property="article:published_time" content="2021-08-29T15:22:14.598Z">
<meta property="article:modified_time" content="2021-08-29T15:22:14.598Z">
<meta property="article:author" content="mozihao">
<meta property="article:tag" content="博客搭建">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/%E6%B5%B7%E8%B4%BCwang5.jpg"><link rel="shortcut icon" href="/blog/img/favicon.png"><link rel="canonical" href="https://mo_zi_hao.gitee.io/blog/posts/40469/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/blog/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/blog/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: true,
  isanchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = { 
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2021-08-29 23:22:14'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    })(window)</script><link rel="stylesheet" type="text/css" href="./css/iconfont.css" media="all"><meta name="generator" content="Hexo 5.4.2"><link rel="alternate" href="/blog/atom.xml" title="mozihao" type="application/atom+xml">
</head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/%E6%B5%B7%E8%B4%BC008.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/blog/archives/"><div class="headline">文章</div><div class="length-num">24</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/blog/tags/"><div class="headline">标签</div><div class="length-num">16</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/blog/categories/"><div class="headline">分类</div><div class="length-num">11</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/blog/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/blog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/blog/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/blog/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/blog/about/"><i class="fa-fw fas fa-heart"></i><span> 前端知识思维导图</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://gitee.com/mo_zi_hao/picsBed/raw/master/image/%E6%B5%B7%E8%B4%BCwang5.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/blog/">mozihao</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/blog/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/blog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/blog/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/blog/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/blog/about/"><i class="fa-fw fas fa-heart"></i><span> 前端知识思维导图</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">从零到白嫖之博客搭建</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2021-08-29T15:22:14.598Z" title="发表于 2021-08-29 23:22:14">2021-08-29</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2021-08-29T15:22:14.598Z" title="更新于 2021-08-29 23:22:14">2021-08-29</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/blog/categories/%E5%8D%9A%E5%AE%A2/">博客</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">1.5k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>5分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="从零到白嫖之博客搭建"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h2 id="11-本地环境需求"><a href="#11-本地环境需求" class="headerlink" title="11.本地环境需求"></a>11.本地环境需求</h2><ul>
<li><p>Git</p>
</li>
<li><p>node.js</p>
</li>
</ul>
<p>上面这两个百度自行安装一下</p>
<h2 id="2-开始部署"><a href="#2-开始部署" class="headerlink" title="2.开始部署"></a>2.开始部署</h2><ol>
<li><p>在本地创建Blog文件夹并进入，用来存放项目</p>
</li>
<li><p>安装淘宝镜像cnpm </p>
<p>快捷键：win + r</p>
<p>然后输入cmd，然后确认</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327100333279.png" alt="image-20210327100333279"></p>
<p>然后输入下面命令，按回车键，等待安装完毕</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install -g cnpm --registry&#x3D;https:&#x2F;&#x2F;registry.npm.taobao.org</span><br></pre></td></tr></table></figure>

<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327100502802.png" alt="image-20210327100502802"></p>
</li>
<li><p>安装Hexo<br>在shell终端(ps:小技巧，当前文件夹加shift+鼠标右键，在此处打开powershell窗口)，执行命令“cnpm install -g hexo”</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cnpm install -g hexo</span><br></pre></td></tr></table></figure>

<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327095546188.png"></p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327095658467.png" alt="image-20210327095658467"></p>
</li>
<li><p>初始化hexo框架，即上一步的那个控制台输入并回车：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo init</span><br></pre></td></tr></table></figure>

<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327103848691.png"></p>
<p>此时你会看到文件夹有东西了</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327104746675.png"></p>
</li>
</ol>
<h2 id="3-安装主题"><a href="#3-安装主题" class="headerlink" title="3.安装主题"></a>3.安装主题</h2><p>此前你可以去hexo的官网看看，选个主题,下面是官网链接：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">https:&#x2F;&#x2F;hexo.io&#x2F;themes&#x2F;</span><br></pre></td></tr></table></figure>

<p>下面是我用过比较好看的两个主题，选其一即可，此前你可以拷贝下面的两个github链接看看是怎样的</p>
<p><a target="_blank" rel="noopener" href="https://github.com/blinkfox/hexo-theme-matery">https://github.com/blinkfox/hexo-theme-matery</a></p>
<p><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">https://github.com/jerryc127/hexo-theme-butterfly</a></p>
<h4 id="方式一：在那个控制台输入命令cnpm-i-主题"><a href="#方式一：在那个控制台输入命令cnpm-i-主题" class="headerlink" title="方式一：在那个控制台输入命令cnpm i + 主题"></a>方式一：在那个控制台输入命令cnpm i + 主题</h4><p>例：hexo-theme-butterfly主题</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm i hexo-theme-butterfly</span><br></pre></td></tr></table></figure>

<h4 id="方式二：在那个控制台输入命令：git-clone-github的主题地址"><a href="#方式二：在那个控制台输入命令：git-clone-github的主题地址" class="headerlink" title="方式二：在那个控制台输入命令：git clone  + github的主题地址"></a>方式二：在那个控制台输入命令：git clone  + github的主题地址</h4><p>主题一：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git clone https:&#x2F;&#x2F;github.com&#x2F;blinkfox&#x2F;hexo-theme-matery.git themes&#x2F;matery</span><br></pre></td></tr></table></figure>

<p>主题二：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git clone https:&#x2F;&#x2F;github.com&#x2F;jerryc127&#x2F;hexo-theme-butterfly.git themes&#x2F;butterfly</span><br></pre></td></tr></table></figure>

<h4 id="方式三：压缩包下载"><a href="#方式三：压缩包下载" class="headerlink" title="方式三：压缩包下载"></a>方式三：压缩包下载</h4><p><strong>（我自己使用的下载方式是直接下载了压缩包，方便我直接再自定义改主题样式）</strong></p>
<p>**注意：不过最近进github的网速有点慢，git clone一直超时（没有这个问题的可以忽略这里），所以我就直接去官网github的网站直接下载下来了 **</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327112538989.png"></p>
<p>打开把下载的主题压缩包放在我们博客文件夹里的themes文件夹，然后将我们下载主题的压缩包解压在当前文件夹</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327114200592.png"></p>
<h2 id="4-接着下一步配置主题"><a href="#4-接着下一步配置主题" class="headerlink" title="4.接着下一步配置主题"></a>4.接着下一步配置主题</h2><p>打开我们的博客文件夹里的_config.yml文件</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327114521591.png"></p>
<p>然后将theme：主题文件夹的名字（如果是使用npm的形式安装主题的，替换为对应的主题名称即可例如我上面下载的主题名字为：butterfly）</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327115356399.png"></p>
<h2 id="5-本地预览博客"><a href="#5-本地预览博客" class="headerlink" title="5.本地预览博客"></a>5.本地预览博客</h2><p>shell终端控制台输入</p>
<p>编译项目，输入命令：hexo g<br>运行项目，输入命令：hexo s</p>
<p>（如果像我这里下面有报错先不管我们稍后解决）</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327121114963.png"></p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327121438267.png"></p>
<p>复制<a href="http://localhost:4000到浏览器打开">http://localhost:4000到浏览器打开</a></p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327123005282.png"></p>
<p>**如果你能正常显示，可以忽略下面我报错的处理 **</p>
<h4 id="我这里报错了，打开是这样的"><a href="#我这里报错了，打开是这样的" class="headerlink" title="我这里报错了，打开是这样的"></a>我这里报错了，打开是这样的</h4><p>extends includes/layout.pug block content include includes/recent-posts.pug include includes/partial</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327121702739.png"></p>
<h5 id="解决方式："><a href="#解决方式：" class="headerlink" title="解决方式："></a><strong>解决方式：</strong></h5><h6 id="shell控制台输入，然后等待安装"><a href="#shell控制台输入，然后等待安装" class="headerlink" title="shell控制台输入，然后等待安装"></a>shell控制台输入，然后等待安装</h6><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cnpm install --save hexo-renderer-jade hexo-generator-feed hexo-generator-sitemap hexo-browsersync hexo-generator-archive</span><br></pre></td></tr></table></figure>

<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327122212015.png"></p>
<h6 id="清除缓存"><a href="#清除缓存" class="headerlink" title="清除缓存"></a>清除缓存</h6><p><code>hexo clean</code></p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327122517005.png"></p>
<h6 id="生成静态文件即可"><a href="#生成静态文件即可" class="headerlink" title="生成静态文件即可"></a>生成静态文件即可</h6><p><code>hexo g</code></p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327122610125.png"></p>
<p>启动服务</p>
<p><code>hexo s</code></p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327121438267.png"></p>
<p>打开我们的页面，当你看到主题的样式出来了说明你成功了，如下图</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327123005282.png"></p>
<h2 id="6-部署到gitee上"><a href="#6-部署到gitee上" class="headerlink" title="6.部署到gitee上"></a>6.部署到gitee上</h2><p>自行注册gitee账号，创建你的blog仓库</p>
<p><a target="_blank" rel="noopener" href="https://gitee.com/">https://gitee.com</a></p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327124839338.png"></p>
<p>好这里我们的仓库创建好了，下面进入我们刚刚建的仓库，复制仓库地址</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327125634491.png"></p>
<p>7.回到我们的博客的文件夹，在_config.yml中配置GIt</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">deploy:</span><br><span class="line">     type: git</span><br><span class="line">     repo: git地址</span><br><span class="line">     branch: master</span><br></pre></td></tr></table></figure>

<p>如下：</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327130046305.png"></p>
<h2 id="7-发布到Gitee"><a href="#7-发布到Gitee" class="headerlink" title="7.发布到Gitee"></a>7.发布到Gitee</h2><p>shell控制台输入：</p>
<ol>
<li><p>输入命令cnpm install hexo-deployer-git –save 安装自动部署发布工具</p>
</li>
<li><p>输入命令hexo clean &amp;&amp; hexo g &amp;&amp; hexo d 发布博客，首次发布需要在shell中输入Gitee的账号和密码。</p>
</li>
</ol>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">cnpm install hexo-deployer-git --save</span><br><span class="line">   hexo clean &amp;&amp; hexo g &amp;&amp; hexo d</span><br></pre></td></tr></table></figure>

<p><strong>注意：</strong> hexo clean &amp;&amp; hexo g &amp;&amp; hexo d可能无法执行，将命令分开执行也可</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">hexo clean</span><br><span class="line">hexo g</span><br><span class="line">hexo d</span><br></pre></td></tr></table></figure>

<p>成功后此时你会看到你的仓库已经有东西了</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327131415284.png"></p>
<h2 id="8-Gitee-Pages设置"><a href="#8-Gitee-Pages设置" class="headerlink" title="8.Gitee Pages设置"></a>8.Gitee Pages设置</h2><p>在我们的Gitee创库选择服务，Gitee Pages</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327131603115.png"></p>
<p>接着勾选强制使用HTTPS，然后点击启动，等待部署完成</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327132011007.png"></p>
<p>部署完之后你会看到你的网站链接了，然后复制网址（下一步有用）</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327132857936.png"></p>
<p><strong>注意：本地博客文件夹的_config.yml中配置下博客地址和路径：</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">url: 你的部署的网址链接</span><br><span class="line">root: 建仓库时候的路径名</span><br></pre></td></tr></table></figure>

<p>例如：我的</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">url:  https:&#x2F;&#x2F;mo_zi_hao.gitee.io&#x2F;myblog&#x2F;</span><br><span class="line">root: &#x2F;myblog</span><br></pre></td></tr></table></figure>

<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327133227280.png" alt="image-20210327133227280"></p>
<p>最后再次在shell终端分别输入执行这三个命令</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">hexo clean</span><br><span class="line">hexo g</span><br><span class="line">hexo d</span><br></pre></td></tr></table></figure>

<h2 id="9-PicGo-Gitee实现个人图床"><a href="#9-PicGo-Gitee实现个人图床" class="headerlink" title="9.PicGo + Gitee实现个人图床"></a>9.PicGo + Gitee实现个人图床</h2><h3 id="首先下载安装PicGo"><a href="#首先下载安装PicGo" class="headerlink" title="首先下载安装PicGo"></a>首先下载安装PicGo</h3><p><a target="_blank" rel="noopener" href="https://molunerfinn.com/PicGo/">https://molunerfinn.com/PicGo/</a></p>
<h3 id="Gitee新建仓库"><a href="#Gitee新建仓库" class="headerlink" title="Gitee新建仓库"></a>Gitee新建仓库</h3><p>像开始创建仓库一样</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327152631649.png"></p>
<h3 id="然后启动安装好的PicGo，并在插件设置搜索gitee安装插件gitee-uploader-1-1-2"><a href="#然后启动安装好的PicGo，并在插件设置搜索gitee安装插件gitee-uploader-1-1-2" class="headerlink" title="然后启动安装好的PicGo，并在插件设置搜索gitee安装插件gitee-uploader 1.1.2"></a>然后启动安装好的<code>PicGo</code>，并在插件设置搜索gitee安装插件<code>gitee-uploader 1.1.2</code></h3><p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327152843278.png"></p>
<p>安装完成后重启软件，在<strong>图床设置</strong>中找到<code>gitee</code>：</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327153701340.png"></p>
<p>接着下一步获取私人令牌，进入<code>个人设置</code></p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327153808351.png"></p>
<p>点击左侧边栏的<code>私人令牌</code></p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327153906506.png"></p>
<p>接着点击<code>生成新令牌</code>,把描述填了之后就会出现token了，然后我们<code>复制这个token到PicGo的token里面</code></p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327154018731.png"></p>
<p><code>点击确认并设为默认图床</code></p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327153701340.png"></p>
<h2 id="10-下载typora，并配置使用PicGo自动上传图片"><a href="#10-下载typora，并配置使用PicGo自动上传图片" class="headerlink" title="10.下载typora，并配置使用PicGo自动上传图片"></a>10.下载typora，并配置使用PicGo自动上传图片</h2><p>进入typora官网下载安装</p>
<p><a target="_blank" rel="noopener" href="https://www.typora.io/">https://www.typora.io/</a></p>
<p>安装完成后，打开typora软件，<code>进入格式</code>  —– <code>图像</code> —–<code>全局图像设置</code></p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327154933604.png"></p>
<p>点击<code>图像</code>,然后按着下图设置就好了</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327155236519.png"></p>
<p>测试一下，你把本地图插入(直接拖拽扔进来或者粘贴进来的图片)，看到图片上面的是一个url链接就证明你成功了，还有PicGo上传成功和失败会在右下角弹出一个弹窗</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327155510385.png" alt="image-20210327155510385"></p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327155722302.png"></p>
<h2 id="11-博客撰写"><a href="#11-博客撰写" class="headerlink" title="11.博客撰写"></a>11.博客撰写</h2><p>在我们博客的文件夹目录里<code>source</code> —<code>_posts</code>文件夹里存放我们的博客文章即可，例如这个文件夹下的hello-world.md文件，我们可以用typora编写，支持Markdown语法，然后在插入的图片自动上传，写完终端运行hexo d上传我们的gitee</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327160725675.png"></p>
<p>最后去我们的gitee点<code>更新</code>即可</p>
<p><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/image-20210327161415371.png"></p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">mozihao</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://mo_zi_hao.gitee.io/blog/posts/40469/">https://mo_zi_hao.gitee.io/blog/posts/40469/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://mo_zi_hao.gitee.io/blog" target="_blank">mozihao</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/blog/tags/%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/">博客搭建</a></div><div class="post_share"><div class="social-share" data-image="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/%E6%B5%B7%E8%B4%BCwang5.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/blog/posts/29998/"><img class="prev-cover" src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/745.jpg" onerror="onerror=null;src='/blog/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">webpack4+vue-cli3</div></div></a></div><div class="next-post pull-right"><a href="/blog/posts/43904/"><img class="next-cover" src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/4560.jpg" onerror="onerror=null;src='/blog/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">pc、h5项目踩坑</div></div></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="card-info-avatar is-center"><img class="avatar-img" src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/%E6%B5%B7%E8%B4%BC008.jpg" onerror="this.onerror=null;this.src='/blog/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">mozihao</div><div class="author-info__description">if you risk nothing,then you risk anthing</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/blog/archives/"><div class="headline">文章</div><div class="length-num">24</div></a></div><div class="card-info-data-item is-center"><a href="/blog/tags/"><div class="headline">标签</div><div class="length-num">16</div></a></div><div class="card-info-data-item is-center"><a href="/blog/categories/"><div class="headline">分类</div><div class="length-num">11</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://gitee.com/mo_zi_hao"><i class="iconfont icon-gitee-fill-round"></i><span>我的Gitee</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://gitee.com/mo_zi_hao" target="_blank" title="Gitee"><i class="fab iconfont icon-gitee-fill-round"></i></a><a class="social-icon" href="https://github.com/mmCrazy" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="https://blog.csdn.net/xiaomohhh?spm=1001.2101.3001.5343" target="_blank" title="CSDN"><i class="fab iconfont icon-csdn"></i></a><a class="social-icon" href="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/qrcode_for_gh_d35478eda980_430.jpg" target="_blank" title="公众号"><i class="fab iconfont icon-weixingongzhonghao"></i></a><a class="social-icon" href="mailto:747304031@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">如文章中有哪些错漏，欢迎各位前端的大佬与我交流并指正，谢谢!!</br>邮箱：747304031@qq.com</br>公众号：一起写前端bug</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#11-%E6%9C%AC%E5%9C%B0%E7%8E%AF%E5%A2%83%E9%9C%80%E6%B1%82"><span class="toc-number">1.</span> <span class="toc-text">11.本地环境需求</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-%E5%BC%80%E5%A7%8B%E9%83%A8%E7%BD%B2"><span class="toc-number">2.</span> <span class="toc-text">2.开始部署</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#3-%E5%AE%89%E8%A3%85%E4%B8%BB%E9%A2%98"><span class="toc-number">3.</span> <span class="toc-text">3.安装主题</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%96%B9%E5%BC%8F%E4%B8%80%EF%BC%9A%E5%9C%A8%E9%82%A3%E4%B8%AA%E6%8E%A7%E5%88%B6%E5%8F%B0%E8%BE%93%E5%85%A5%E5%91%BD%E4%BB%A4cnpm-i-%E4%B8%BB%E9%A2%98"><span class="toc-number">3.0.1.</span> <span class="toc-text">方式一：在那个控制台输入命令cnpm i + 主题</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%96%B9%E5%BC%8F%E4%BA%8C%EF%BC%9A%E5%9C%A8%E9%82%A3%E4%B8%AA%E6%8E%A7%E5%88%B6%E5%8F%B0%E8%BE%93%E5%85%A5%E5%91%BD%E4%BB%A4%EF%BC%9Agit-clone-github%E7%9A%84%E4%B8%BB%E9%A2%98%E5%9C%B0%E5%9D%80"><span class="toc-number">3.0.2.</span> <span class="toc-text">方式二：在那个控制台输入命令：git clone  + github的主题地址</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%96%B9%E5%BC%8F%E4%B8%89%EF%BC%9A%E5%8E%8B%E7%BC%A9%E5%8C%85%E4%B8%8B%E8%BD%BD"><span class="toc-number">3.0.3.</span> <span class="toc-text">方式三：压缩包下载</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#4-%E6%8E%A5%E7%9D%80%E4%B8%8B%E4%B8%80%E6%AD%A5%E9%85%8D%E7%BD%AE%E4%B8%BB%E9%A2%98"><span class="toc-number">4.</span> <span class="toc-text">4.接着下一步配置主题</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#5-%E6%9C%AC%E5%9C%B0%E9%A2%84%E8%A7%88%E5%8D%9A%E5%AE%A2"><span class="toc-number">5.</span> <span class="toc-text">5.本地预览博客</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%88%91%E8%BF%99%E9%87%8C%E6%8A%A5%E9%94%99%E4%BA%86%EF%BC%8C%E6%89%93%E5%BC%80%E6%98%AF%E8%BF%99%E6%A0%B7%E7%9A%84"><span class="toc-number">5.0.1.</span> <span class="toc-text">我这里报错了，打开是这样的</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#%E8%A7%A3%E5%86%B3%E6%96%B9%E5%BC%8F%EF%BC%9A"><span class="toc-number">5.0.1.1.</span> <span class="toc-text">解决方式：</span></a><ol class="toc-child"><li class="toc-item toc-level-6"><a class="toc-link" href="#shell%E6%8E%A7%E5%88%B6%E5%8F%B0%E8%BE%93%E5%85%A5%EF%BC%8C%E7%84%B6%E5%90%8E%E7%AD%89%E5%BE%85%E5%AE%89%E8%A3%85"><span class="toc-number">5.0.1.1.1.</span> <span class="toc-text">shell控制台输入，然后等待安装</span></a></li><li class="toc-item toc-level-6"><a class="toc-link" href="#%E6%B8%85%E9%99%A4%E7%BC%93%E5%AD%98"><span class="toc-number">5.0.1.1.2.</span> <span class="toc-text">清除缓存</span></a></li><li class="toc-item toc-level-6"><a class="toc-link" href="#%E7%94%9F%E6%88%90%E9%9D%99%E6%80%81%E6%96%87%E4%BB%B6%E5%8D%B3%E5%8F%AF"><span class="toc-number">5.0.1.1.3.</span> <span class="toc-text">生成静态文件即可</span></a></li></ol></li></ol></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#6-%E9%83%A8%E7%BD%B2%E5%88%B0gitee%E4%B8%8A"><span class="toc-number">6.</span> <span class="toc-text">6.部署到gitee上</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#7-%E5%8F%91%E5%B8%83%E5%88%B0Gitee"><span class="toc-number">7.</span> <span class="toc-text">7.发布到Gitee</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#8-Gitee-Pages%E8%AE%BE%E7%BD%AE"><span class="toc-number">8.</span> <span class="toc-text">8.Gitee Pages设置</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#9-PicGo-Gitee%E5%AE%9E%E7%8E%B0%E4%B8%AA%E4%BA%BA%E5%9B%BE%E5%BA%8A"><span class="toc-number">9.</span> <span class="toc-text">9.PicGo + Gitee实现个人图床</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%A6%96%E5%85%88%E4%B8%8B%E8%BD%BD%E5%AE%89%E8%A3%85PicGo"><span class="toc-number">9.1.</span> <span class="toc-text">首先下载安装PicGo</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Gitee%E6%96%B0%E5%BB%BA%E4%BB%93%E5%BA%93"><span class="toc-number">9.2.</span> <span class="toc-text">Gitee新建仓库</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%84%B6%E5%90%8E%E5%90%AF%E5%8A%A8%E5%AE%89%E8%A3%85%E5%A5%BD%E7%9A%84PicGo%EF%BC%8C%E5%B9%B6%E5%9C%A8%E6%8F%92%E4%BB%B6%E8%AE%BE%E7%BD%AE%E6%90%9C%E7%B4%A2gitee%E5%AE%89%E8%A3%85%E6%8F%92%E4%BB%B6gitee-uploader-1-1-2"><span class="toc-number">9.3.</span> <span class="toc-text">然后启动安装好的PicGo，并在插件设置搜索gitee安装插件gitee-uploader 1.1.2</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#10-%E4%B8%8B%E8%BD%BDtypora%EF%BC%8C%E5%B9%B6%E9%85%8D%E7%BD%AE%E4%BD%BF%E7%94%A8PicGo%E8%87%AA%E5%8A%A8%E4%B8%8A%E4%BC%A0%E5%9B%BE%E7%89%87"><span class="toc-number">10.</span> <span class="toc-text">10.下载typora，并配置使用PicGo自动上传图片</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#11-%E5%8D%9A%E5%AE%A2%E6%92%B0%E5%86%99"><span class="toc-number">11.</span> <span class="toc-text">11.博客撰写</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/blog/posts/1/" title="无题"><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/%E6%B5%B7%E8%B4%BC4.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="无题"/></a><div class="content"><a class="title" href="/blog/posts/1/" title="无题">无题</a><time datetime="2022-06-05T05:20:17.974Z" title="发表于 2022-06-05 13:20:17">2022-06-05</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/posts/36549/" title="编写可维护的JavaScript (代码习惯)"><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/%E6%B5%B7%E8%B4%BC4.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="编写可维护的JavaScript (代码习惯)"/></a><div class="content"><a class="title" href="/blog/posts/36549/" title="编写可维护的JavaScript (代码习惯)">编写可维护的JavaScript (代码习惯)</a><time datetime="2022-03-19T03:12:42.624Z" title="发表于 2022-03-19 11:12:42">2022-03-19</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/posts/23125/" title="gitlab-cicd"><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/745.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="gitlab-cicd"/></a><div class="content"><a class="title" href="/blog/posts/23125/" title="gitlab-cicd">gitlab-cicd</a><time datetime="2021-12-20T14:00:59.661Z" title="发表于 2021-12-20 22:00:59">2021-12-20</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/posts/449/" title="前端js基础"><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/26&amp;gp=0.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="前端js基础"/></a><div class="content"><a class="title" href="/blog/posts/449/" title="前端js基础">前端js基础</a><time datetime="2021-08-29T15:22:14.600Z" title="发表于 2021-08-29 23:22:14">2021-08-29</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/posts/35506/" title="微信小程序"><img src="https://gitee.com/mo_zi_hao/picsBed/raw/master/image/1234.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="微信小程序"/></a><div class="content"><a class="title" href="/blog/posts/35506/" title="微信小程序">微信小程序</a><time datetime="2021-08-29T15:22:14.600Z" title="发表于 2021-08-29 23:22:14">2021-08-29</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By mozihao</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><div class="search-dialog__title" id="local-search-title">本地搜索</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div></div><hr/><div id="local-search-results"></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="/blog/js/utils.js"></script><script src="/blog/js/main.js"></script><script src="/blog/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script src="/blog/js/search/local-search.js"></script><div class="js-pjax"></div><script id="click-heart" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-heart.min.js" async="async" mobile="false"></script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>